package ISBN;

import java.util.Scanner;

/**
 * @Author Stringzhua
 * @Date 2024/4/21 12:12
 * description:
 */
public class test02 {
    public static void main(String[] args) {
//        String ISBN = "0-670-82162-0";
        Scanner scan = new Scanner(System.in);
        String ISBN = scan.nextLine();
        int[] ArrISBN = new int[ISBN.length() - 3];
        //1.去除-
        int sum = 0;
        int idCard = 0;
        int index = 0;//添加一个索引变量记录当前数组的位置
        for (int i = 0; i < ISBN.length(); i++) {
            char c = ISBN.charAt(i);
            if (c == '-') {
                continue;//如果为-，结束本次循环
            }
            //2.将去除后的c加入到数组中
            ArrISBN[index++] = c - '0';//将字符c转换成数字并存储到数组
        }
        //3.首位数字乘以1加上次位数字乘以2.以此类推到第九位，用所得的结果 mod 11，所得的余数即为识别码，
        for (int k = 0; k < ArrISBN.length - 1; k++) {
            sum = sum + ArrISBN[k] * (k + 1);//计算上次位数字+本次数字*第几位
        }
        //4.计算识别码
        idCard = sum % 11;
        System.out.println(idCard);
        //5.判断
        int lastISBN = Integer.parseInt(ISBN.substring(ISBN.length() - 1));
        if (lastISBN == idCard) {
            System.out.println("Right");
        } else {
            if (idCard == 10) {
                idCard = 'X';
            }
            ISBN = ISBN.substring(0, ISBN.length() - 1) + idCard;
            System.out.println(ISBN);
        }
    }
}